import { request } from '@/utils/request';
export const getJobsList = (data: any) => {
  // 处理数组参数，将数组转换为字符串
  const processedData = { ...data };
  if (processedData.backups && Array.isArray(processedData.backups)) {
    processedData.backups = processedData.backups.join(',');
  }
  return request({
    url: `/jobs/list`,
    method: 'get',
    params: processedData,
  });
};

// 删除作业
export const deleteJobs = (data: any) => {
  return request({
    url: `/jobs/delete`,
    method: 'delete',
    data,
  });
};

// 作业执行
export const reRunJob = (data: any) => {
  return request({
    url: `/jobs/reTry`,
    method: 'post',
    data,
  });
};

// 获取作业详情
export const getJobDetail = (id: string) => {
  return request({
    url: `/jobs/list/${id}`,
    method: 'get',
  });
};
